All Packages Class Hierarchy This Package Previous Next Index
The kind of classes that interact this way generally have some interdependence and so the NotifyListener will generally expect its Notifier to be a a particular type of object.
When a NotifyListener is added to a Notifier if the NotifyListener and Notifier are compatible the addNotifyListener returns true, at that point the Notifier can notify its Listener when the condition it is awaiting is fulfilled.
For instance, the QTImageDrawer is a Notifier and the TwoDSprite is a NotifyListener. A TwoDSprite requires valid image data before it can present an image in a SWCompositor. A QTImageDrawer does not have valid image data until it has been added to a java.awt.Component. Thus the QTImageDrawer has a need to notify its TwoDSprite when its image data is complete and valid. The TwoDSprite is a NotifyListener that expects its Notifiers to also implement the ImageSpec interface. When the QTImageDrawer has valid image data it notifies its TwoDSprite listener and the TwoDSprite can retrieve that image data and present it within the context of its Compositor.
This type of pairing can be used in other situations where some deferral of resources is an issue. For example a class could be defined that downloads image data through a network connection. When the image data is completely retrieved this type of Notifier could then notify a TwoDSprite (for instance) that its image data is now complete.
public abstract boolean addNotifyListener(NotifyListener nl)
All Packages Class Hierarchy This Package Previous Next Index